﻿# CMakeList.txt: 顶层 CMake 项目文件，在此处执行全局配置
# 并包含子项目。
#
cmake_minimum_required (VERSION 3.8)

# 如果支持，请为 MSVC 编译器启用热重载。
if (POLICY CMP0141)
  cmake_policy(SET CMP0141 NEW)
  set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
	# Debug 配置
	message(STATUS "CMAKE_BUILD_TYPE Debug")
elseif (${CMAKE_BUILD_TYPE} STREQUAL "Release")
	message(STATUS "CMAKE_BUILD_TYPE Release")
	# Release 配置
	set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os -Wall -s")
	set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -Wall -s")
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_BUILD_TYPE})
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT_DIR})

set(THIRDPARTY depend)
set(FFMPEG_INCLUDE ${THIRDPARTY}/ffmpeg/include)
set(SDL_INCLUDE ${THIRDPARTY}/SDL/include)
set(MAGICENUM_INCLUDE ${THIRDPARTY}/magic_enum)
## lib文件
set(FFMPEG_LIBRARIES ${THIRDPARTY}/ffmpeg/lib)
set(SDL_LIBRARIES ${THIRDPARTY}/SDL)

# 链接外部库
include_directories(${FFMPEG_INCLUDE})
include_directories(${SDL_INCLUDE})
include_directories(${MAGICENUM_INCLUDE})

link_directories(${FFMPEG_LIBRARIES})
link_directories(${SDL_LIBRARIES})

# 包含子项目。
add_subdirectory("ffmpeg")
add_subdirectory("sdl")

